<?php

namespace Bundle\AclBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Components\DependencyInjection\ContainerBuilder;

class AclExtension extends Extension
{
    protected $resources = array(
        'acl' => 'acl.xml',
    );

    public function configLoad($config, \Symfony\Component\DependencyInjection\ContainerBuilder $container)
    {
        
        //if(!$container->hasDefinition('acl'))
        {
            $loader = new XmlFileLoader($container, __DIR__ . '/../Resources');
            $loader->load($this->resources['acl']);
            //$container->setAlias('acl', 'zend.acl');
        }
    }
//
//    public function loggerLoad($config, ContainerBuilder $container)
//    {
//        if (!$container->hasDefinition('zend.logger')) {
//            $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
//            $loader->load($this->resources['logger']);
//            $container->setAlias('logger', 'zend.logger');
//        }
//
//        if (isset($config['priority'])) {
//            $container->setParameter('zend.logger.priority', is_int($config['priority']) ? $config['priority'] : constant('\\Zend\\Log\\Logger::'.strtoupper($config['priority'])));
//        }
//
//        if (isset($config['path'])) {
//            $container->setParameter('zend.logger.path', $config['path']);
//        }
//    }

    /**
     * Returns the base path for the XSD files.
     *
     * @return string The XSD base path
     */
    public function getXsdValidationBasePath()
    {
        return __DIR__.'/../Resources/config/schema';
    }

    public function getNamespace()
    {
        return 'http://www.symfony-project.org/schema/dic/zend';
    }

    public function getAlias()
    {
        return 'acl';
    }
}
